import Mock from 'mockjs'
export default{
    getMenu:config=>{
        const {email,userPassword} = JSON.parse(config.body);
        //先判断用户是否存在
        //判断账号和密码是否对应
        if(email === 'admin' && userPassword === 'admin'){
            return{
                code:200,
                data:{
                    menu:[
                        {
                            path:'/home',
                            name:'home',
                            label:'首页',
                            icon:'HomeFilled',
                            url:'home/home'
                        },
                        {
                            path:'/article',
                            name:'article',
                            label:'文章管理',
                            icon:'video-play',
                            url:'article/article'
                        },  
                        {
                            path:'/user',
                            name:'user',
                            label:'用户管理',
                            icon:'Avatar',
                            url:'user/user'
                        },
                        {
                            path:'/other',
                            label:'其它',
                            icon:'MoreFilled',
                            children:[
                                {
                                    path:'/page1',
                                    name:'page1',
                                    label:'页面1',
                                    icon:'Tools',
                                    url:'page1'
                                },
                                {
                                    path:'/page2',
                                    name:'page2',
                                    label:'页面2',
                                    icon:'Tools',
                                    url:'page2'
                                }
                            ]
                        }
                    ],
                    token:Mock.Random.guid(),
                    msg:'获取成功'
                }
            }
        }else if(email === 'tudou' && userPassword === 'tudou'){
                return{
                    code:200,
                    data:{
                        menu:[
                            {
                                path:'/home',
                                name:'home',
                                label:'首页',
                                icon:'HomeFilled',
                                url:'home/home'
                            },
                            {
                                path:'/article',
                                name:'article',
                                label:'文章管理',
                                icon:'video-play',
                                url:'article/article'
                            },  
                        ],
                        token:Mock.Random.guid(),
                        msg:'获取成功'
                    }
                }
            
        }
        else{
            return{
                code:-999,
                data:{
                    msg:'用户名或密码错误'
                }
            }
        }
    }
}